// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
    const db=cloud.database()
    const todo=db.collection("toDo")
    const wxContext = cloud.getWXContext()
    const title=event.title
    const desc=event.desc
    const time=event.time
    const hasTime=event.hasTime
    const classify=event.classify
    todo.add({
        data:{
            _openid:wxContext.OPENID,
            title:title, 
            description:desc,
            time:time,
            hasTime:hasTime,
            done:false,
            classify:classify
        },
    })
}
